import { CrudOption } from '@zl-crud/components'
import { SearchType } from '@zl-crud/common'

const option: CrudOption = {
  // <<==== 标题栏 ====>>
  headTitle: '验收入库',

  // <<==== 快捷检索 ====>>
  tabAll: true,
  tabs: [
    { label: '待验收', value: [], type: SearchType.or, default: true },
    { label: '已验收', value: [], type: SearchType.or, default: true },
  ],

  // <<==== 表格 ====>>
  isMerge: true,
  mergeKey: 'code',
  AvueOption: {
    // menu: false,
    menuWidth: 80,
    column: [
      { label: '订单编号', prop: 'orderCode', merge: true },
      { label: '开始日期', prop: 'endTime', type: 'date', merge: true, width: 130 },
      { label: '订单类型', prop: 'type_value', merge: true, width: 70 },
      { label: '供应商', prop: 'supplierId_value', merge: true, width: 80 },
      { label: '采购员', prop: 'chargeUser_value', merge: true, width: 80 },
      { label: '合同编号', prop: 'contractCode', merge: true, click: true, clickKey: 'contractCode', width: 100 }, // 点击调整查看合同
      // { label: '物流状态', prop: 'tmsStatus', merge: true, click: true, clickKey: 'tmsStatus', width: 100 }, // 点击调整查看物流情况
      { label: '订单金额', prop: 'actualAmount', type: 'number', merge: true, width: 80 },
      { label: '付款金额', prop: 'payAmount', type: 'number', merge: true, click: true, clickKey: 'actualAmount', width: 120 },
      { label: '发票金额', prop: 'invoiceAmount', type: 'number', merge: true, width: 80 },
      { label: '要求日期', prop: 'endTime', type: 'date', merge: true, width: 130 },
      { label: '物品编号', prop: 'goodCode', width: 80 },
      { label: '物品名称', prop: 'goodName', width: 80 },
      { label: '规格', prop: 'goodSpec', width: 80 },
      { label: '型号', prop: 'goodModel', width: 80 },
      { label: '类别', prop: 'goodInfo', width: 80 },
      { label: '标准', prop: 'goodStandard', width: 80 },
      { label: '制造商', prop: 'goodManufacturer', width: 80 },
      { label: '单位', prop: 'goodUnit', width: 80 },
      { label: '数量', prop: 'goodNum', type: 'number', width: 80 },
      { label: '单价/元', prop: 'goodPrice', type: 'number', click: true, clickKey: 'goodPrice', width: 100 }, // 点击单价、查看历史价格走势、采购记录等
      { label: '金额/元', prop: 'goodAmount', type: 'number', width: 100 },
      { label: '到货数量', prop: 'arrivalNum', type: 'number', width: 100, fixed: 'right' },
      { label: '不合格数量', prop: 'unqualifiedNum', type: 'number', width: 80, fixed: 'right' },
      { label: '备注', prop: 'notes' },
    ],
  },

  isTree: true,
  treeOpen: true,
  treeOption: { width: 220, title: '部门', mock: true, AvueOption: { addBtn: false, menu: false } },

  // <<==== 接口 ====>>
  mock: true,
  mockTemplate: {
    orderCode: '@word(8)',
    endTime: '@date',
    type_value: '@word(6)',
    supplierId_value: '@word(8)',
    chargeUser_value: '@cname',
    contractCode: '@word(10)',
    tmsStatus: '@word(6)',
    actualAmount: '@float(1000, 50000, 2, 2)',
    payAmount: '@float(1000, 50000, 2, 2)',
    invoiceAmount: '@float(1000, 50000, 2, 2)',
    goodCode: '@word(8)',
    goodName: '@word(6)',
    goodSpec: '@word(5)',
    goodModel: '@word(5)',
    goodInfo: '@word(4)',
    goodStandard: '@word(10)',
    goodManufacturer: '@word(8)',
    goodUnit: "@pick(['个', '件', '米', '千克', '套'])",
    goodNum: '@integer(1, 1000)',
    goodPrice: '@float(1, 1000, 2, 2)',
    goodAmount: '@float(1000, 50000, 2, 2)',
    arrivalNum: '@integer(1, 1000)',
    unqualifiedNum: '@integer(1, 1000)',
  },
}

export default option
